package cn.javasea.rbac.shiro.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: 未授权返回信息给页面
 * @Author: xiangchao
 * @Date: 2023/2/1 2:27 下午
 */
@ControllerAdvice
public class NoPermissionController {

    @ResponseBody
    @ExceptionHandler(AuthorizationException.class)
    public String authorizationException() {
        System.out.println("无权限====="+ SecurityUtils.getSubject().getSession().getId());
        return "账号无权限";
    }

}
